Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extends "spo user ensure" command with support for specifying more options. Closes #6181 #6426

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

nanddeepn
Copy link
Contributor

Extends spo user ensure command with support for specifying loginName, entraGroupId, and entraGroupName options. Closes #6181

@milanholemans
Copy link
Contributor

Thank you @nanddeepn, we'll try to review it ASAP!

@Adam-it Adam-it added the hacktoberfest-accepted Accept for hacktoberfest, will merge later label Oct 29, 2024
@Adam-it
Copy link
Member

Adam-it commented Oct 29, 2024

@nanddeepn I added the hacktoberfest-accepted label to this PR which means that this PR will count as done for the Hacktoberfest event. So if you participate in this event it will get you unblocked and it allows us to merge this PR later when we catch up 👍
Thanks for your support and awesome contribution 👏 You Rock 🤩

@milanholemans milanholemans self-assigned this Nov 17, 2024
Copy link
Contributor

@milanholemans milanholemans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice start, let's do a couple of changes before we proceed.

docs/docs/cmd/spo/user/user-ensure.mdx Outdated Show resolved Hide resolved
docs/docs/cmd/spo/user/user-ensure.mdx Outdated Show resolved Hide resolved
docs/docs/cmd/spo/user/user-ensure.mdx Show resolved Hide resolved
docs/docs/cmd/spo/user/user-ensure.mdx Outdated Show resolved Hide resolved
docs/docs/cmd/spo/user/user-ensure.mdx Outdated Show resolved Hide resolved
src/m365/spo/commands/user/user-ensure.spec.ts Outdated Show resolved Hide resolved
src/m365/spo/commands/user/user-ensure.spec.ts Outdated Show resolved Hide resolved
});

await command.action(logger, { options: { verbose: true, webUrl: validWebUrl, entraGroupName: validEntraSecurityGroupName } });
assert(loggerLogSpy.calledWith(ensuredSecurityGroupResponse));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's check the request body instead of the output of the command.

src/m365/spo/commands/user/user-ensure.spec.ts Outdated Show resolved Hide resolved
src/m365/spo/commands/user/user-ensure.spec.ts Outdated Show resolved Hide resolved
@milanholemans milanholemans marked this pull request as draft November 19, 2024 22:04
@milanholemans
Copy link
Contributor

@nanddeepn, did you find some time to look at my comments?

@nanddeepn
Copy link
Contributor Author

@nanddeepn, did you find some time to look at my comments?

I have started working on it. Facing some issues with merge conflicts, but will let you know when I update the PR. Thank you.

@nanddeepn nanddeepn marked this pull request as ready for review December 9, 2024 11:00
@nanddeepn
Copy link
Contributor Author

Hi @milanholemans
Ready for review.

Copy link
Contributor

@milanholemans milanholemans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from a few tiny remarks, nothing to add.

});

await command.action(logger, { options: { verbose: true, webUrl: validWebUrl, loginName: validLoginName } });
assert(loggerLogSpy.calledWith(ensuredUserResponse));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's check for the request body here as well.

Comment on lines +238 to +240
sinon.stub(entraGroup, 'getGroupById').callsFake(async () => {
return groupM365Response.value[0];
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sinon.stub(entraGroup, 'getGroupById').callsFake(async () => {
return groupM365Response.value[0];
});
sinon.stub(entraGroup, 'getGroupById').resolves(groupM365Response.value[0]);

Comment on lines +255 to +257
sinon.stub(entraGroup, 'getGroupByDisplayName').callsFake(async () => {
return groupSecurityResponse.value[0];
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sinon.stub(entraGroup, 'getGroupByDisplayName').callsFake(async () => {
return groupSecurityResponse.value[0];
});
sinon.stub(entraGroup, 'getGroupByDisplayName').ensures(groupSecurityResponse.value[0]);

Comment on lines +272 to +274
sinon.stub(entraGroup, 'getGroupByDisplayName').callsFake(async () => {
return groupM365Response.value[0];
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use .resolves(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Accept for hacktoberfest, will merge later
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance spo user ensure with more options
3 participants